<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css"/>
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css"/>

		<script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/dialog/js/dialog.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.form.js"></script>
		<script src="/js/common.js"></script>
		<script src="/js/flatpickr.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<!--顶部导航 -->
		<nav class="topNavItemBox">
			<div id="ItemBox">
				<div class="title">肉品溯源管理系统</div>
			</div>
		</nav>
		<!-- 左侧导航 -->
		<#include "left.ftl" />

		<!-- 新增检疫信息 -->
		<div class="page_main">
			<h3>检疫情况管理</h3><span class="add_link"><a href="/admin/ProInspect/findByCondition">查询生猪检疫信息></a></span>
			<br />
			<div class="page_content">
			<h4>检疫情况新增</h4>
				<form id="quarantine_addform" action="/admin/ProInspect/addProInspect" method="post">
					<ul>
						<li><label class="labelBeforinput">生猪编号</label><input name="proInspectInfo.purcid" id="purcid" onblur="checkPurcharse()" class="bigInputtext" maxlength="9" required data-rule-isIntGtZero="true" type="text" /></li>
						<li><label class="labelBeforinput">养殖厂</label><select name="proInspectInfo.compid" class="bigInputtext" data-rule-notZero="true"><option value="0">请选择</option></select></li>
						<li><label class="labelBeforinput">检验类型</label>
						<input type="radio" value="2" name="proInspectInfo.inspectype" checked/>人工检验
						<input type="radio" value="1" name="proInspectInfo.inspectype"/>自动检验
						</li>
						
						
						<li><label class="labelBeforinput">检验结果</label>
							<input type="radio" required name="proInspectInfo.resulttype" value="1"/>合格
							<input type="radio" required name="proInspectInfo.resulttype" value="2"/>不合格
						</li>
						<li><label class="labelBeforinput">检验时间</label><input name="proInspectInfo.inspecttime" class="bigInputtext" required id="test1" data-date-format="Y-m-d" /></li>
						<li><label class="labelBeforinput">检验人姓名</label><input name="proInspectInfo.inspectorname" class="bigInputtext" required type="text" /></li>
						<li><label class="labelBeforinput">检验人编号</label><input name="proInspectInfo.inspectorid" class="bigInputtext" data-rule-isIntGtZero="true" required type="text" /></li>
						<li><label class="labelBeforinput">检验说明</label><input name="proInspectInfo.resultnotes" class="bigInputtext" required type="text" /></li>
						<br/><br/><br/><span style="color:red;font-size:13px; margin-left:330px">若为最后出厂的检验，请务必填入下列信息</span>
						<li><label class="labelBeforinput">屠宰许可证号</label><input name="slaughterPermitNo" class="bigInputtext"  type="text" /></li>
						<li><label class="labelBeforinput">屠宰流水线编号</label><input name="proInspectInfo.proclineid" class="bigInputtext"  type="text" /></li>
						<li><label class="labelBeforinput">屠宰流水线名称</label><input name="proInspectInfo.proclinename" class="bigInputtext"  type="text" /></li>
						<li><label class="labelBeforinput">检验环节名称</label><input name="resultNotes" class="bigInputtext"  type="text" /></li>
						<li><input type="submit" value="添加记录" style="margin-left: 170px; width: 200px;" /></li>
					</ul>

				</form>
			</div>
			<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" charset="UTF-8">
		$(function() {
			//初始化侧边栏
			$(".vertical-nav").verticalnav({
				speed: 400,
				align: "left"
			});
			
			//时间控制器
			$("#quarantine_time").flatpickr();
			//表单校验
			$("#quarantine_addform").validate();
			$.post("/admin/company/findCompanyByFeedType?typeID=1001", function(data) {
				for(var i = 0; i < data.length; i++) {
					$("select[name='proInspectInfo.compid']").append("<option value='" + data[i].gid + "'>" + data[i].compname + "</option>");
					}
			});	
			//表单提交
			$("#quarantine_addform").ajaxForm({

                success:function(data) {
                    var str = null;
                    var msg = null;
                    if(data.msg == 1){
                        str = "success";
                        msg = "添加成功"
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="dialog/images/icon/'+str+'.png" alt="'+msg+'" />',
                            autoClose: 2000
                        });
                        setTimeout('window.location="/admin/ProInspect/findByCondition"',3000);

                    }else{
                        str = "fail";
                        msg = "添加失败，请输入正确的生猪编号";
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="dialog/images/icon/'+str+'.png" alt="'+msg+'" />',
                            autoClose: 2000
                        });
                    }
                }
        });
		});

		//检验生猪信息是否存在
		function checkPurcharse() {
            var pid = $("#purcid").val();
            $.get("/admin/ProInspect/checkPur?pid="+pid,function (data) {
                var str = null;
                var msg = null;
                if(data.msg == 1){
                    str = "false";
                    msg = "该生猪编号不存在";
                    $.dialog({
                        type: 'info',
                        contentHtml: '<img class="info-icon" src="dialog/images/icon/'+str+'.png" alt="'+msg+'" />',
                        autoClose: 2000
                    });
                    $("#purcid").val("");
            }else{
                    str = "success";
                    msg = data.message;
                    $.dialog({
                        type: 'info',
                        contentHtml: '<img class="info-icon" src="dialog/images/icon/'+str+'.png" alt="'+msg+'" />',
                        autoClose: 2000
                    });
                }
                    }
                );
        }

	</script>

</html>